Skip to content

Conversation

@bobtista
Copy link

Refactors path-following functions to use move when transferring std::vector<Coord3D> ownership

Changes:

  • Updated aiFollowExitProductionPath and aiFollowPath inline functions to accept non-const vector pointers and use std::move
  • Modified AIStateMachine::setGoalPath to move the vector instead of copying
  • Updated privateFollowPath and doQuickExit signatures to support move semantics

@bobtista bobtista marked this pull request as ready for review November 25, 2025 17:58
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check that the passed vector is never used after it is consumed?

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Performance Is a performance concern labels Nov 25, 2025
@bobtista
Copy link
Author

Did you check that the passed vector is never used after it is consumed?

Looking at call sites, they all pass local vectors (exitPath, path) that are not used after the function call. They go out of scope immediately, so this is safe, right?

@xezon
Copy link

xezon commented Nov 25, 2025

Yes, when the std::vector contents are not used anymore after they are now consumed by the functions then this is safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Minor Severity: Minor < Major < Critical < Blocker Performance Is a performance concern

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider moving std::vector instead of copying the data

3 participants